<template>
    <div>
        <h2>home page</h2>
        <button @click ="goHot">去沸点</button> 
    </div>
</template>

<script setup>
// import router from '../router'
import { useRouter } from 'vue-router' //如果router放的过深可以用这个
const router = useRouter()

const goHot = () =>{
    // router.push('/hot');
    //router.replace('/hot')   // 浏览器无法回退 push可以
    //replace 会直接将历史记录里面的home替换成hot，push是在home上面加一个hot
    // router.push({path:'/hot',query:{id:123}})
    router.push({name:'/hot',params:{id:123}}) 

}
</script>

<style lang="css" scoped>

</style>